From e20a3339bfdf69c23f036024692c710812d5154a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 20 Oct 2020 21:31:23 -0400 Subject: [PATCH] atsi: Fix emission of text selection changes We were not emitting text-selection-changed and text-caret-moved as expected. --- gtk/a11y/gtkatspicontext.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index a72a6ad40e..b030d1cfd7 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -729,14 +729,24 @@ emit_text_selection_changed (GtkAtSpiContext *self, const char *kind, int cursor_position) { - g_dbus_connection_emit_signal (self->connection, - NULL, - self->context_path, - "org.a11y.atspi.Event.Object", - "TextChanged", - g_variant_new ("(siiva{sv})", - kind, cursor_position, 0, g_variant_new_string (""), NULL), + if (strcmp (kind, "text-caret-moved") == 0) + g_dbus_connection_emit_signal (self->connection, + NULL, + self->context_path, + "org.a11y.atspi.Event.Object", + "TextCaretMoved", + g_variant_new ("(siiva{sv})", + "", cursor_position, 0, g_variant_new_string (""), NULL), NULL); + else + g_dbus_connection_emit_signal (self->connection, + NULL, + self->context_path, + "org.a11y.atspi.Event.Object", + "TextSelectionChanged", + g_variant_new ("(siiva{sv})", + "", 0, 0, g_variant_new_string (""), NULL), + NULL); } static void -- 2.30.2